<%@page import="com.davinci.freemarket.dataModelLayer.model.CommentModel"%>
<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" import = "java.util.ArrayList" import="com.davinci.freemarket.dataModelLayer.model.PublicationModel" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Styling Ordered Lists with CSS</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
  <script type="text/javascript">
  $(document).ready(function(){
	
    $("ol.steps li:first")
    .addClass("first");
	
    $("ol.steps li:last")
    .addClass("last");
		
  });
  </script>
<style type="text/css">

body {
	margin: 0;
	padding: 50px;
	font: 10px normal Verdana, Arial, Helvetica, sans-serif;
	background: #1d1d1d;
	color: #fff;
}
* {
	margin: 0;
	padding: 0;
}
h1 {
	font: 5em normal Georgia, 'Times New Roman', Times, serif;
	text-align:center;
	padding-bottom: 20px;
}
h1 span { color: #cbff78; }
h1 small{
	font: 0.2em normal Verdana, Arial, Helvetica, sans-serif;
	text-transform:uppercase;
	letter-spacing: 1.5em;
	display: block;
	color: #666;
}
.container {
	width: 600px;
	margin: 0 auto;
}
ol.steps {
	margin: 20px 0;
	background: #333;
	padding: 0 0 0 35px;
	border: 1px solid #111;
	background: url(ul_bg_repeat.gif) repeat-y;
}
ol.steps li {
	margin: 0;
	padding: 15px 15px;
	color: #cbff78;
	font-size: 1.7em;
	font-weight: bold;
	border-top: 1px solid #000;
	border-bottom: 1px solid #353535;
	border-right: 1px solid #333;
	border-left: 1px solid #151515;
	background: #222;
}
ol.steps li h2 {
	font-size: 0.9em;
	padding: 5px 0;
	margin-bottom: 10px;
	border-bottom: 1px dashed #333;
	color: #fff;
}
ol.steps li p {
	color: #ccc;
	font-size: 0.7em;
	font-weight: normal;
	line-height: 1.6em;
}
ol.steps li.first { border-top: 1px solid #333; }
ol.steps li.last {	border-bottom: none; }


.submitStyle {
	padding: 5px;
}

ul.commentsStyle {
	font-size: 0.9em;
	font-weight: normal;
	list-style: none;
}

</style>
</head>


<body>

<div class="container">
<h1><span>Lista de publicaciones por Usuario</span> <small>resultado de su busqueda</small></h1>

	<ol class="steps">
	<%
		ArrayList<PublicationModel> publications = (ArrayList<PublicationModel>) session.getAttribute("publications");%>
		<%
		for(PublicationModel publication : publications){ 
		%>
			<li>
				<h2><%out.println(publication.getTitle());%><a href="GetPublicationServlet?publish_identifier=<%out.println(publication.getPublicationId());%>">[+]</a></h2>
				<p><%out.println("$ " + publication.getPrice());%></p>
			</li>
			<hr />
			<ul class="commentsStyle">
			<%
				ArrayList<CommentModel> comments = publication.getComments();
				%>
				<%
				for(CommentModel comment : comments){ 
					if(comment.getAnswered() == 0){
				%>
					<li>
						<p>P: <%out.println(comment.getQuestion());%></p>
						<!-- HTML codes by Quackit.com -->
						<form action="ResponseServlet?comment_identifier=<%out.println(comment.getCommentID());%>" method="post">
							<textarea name="response" id="response"></textarea>
						  	<br />
				            <input type="hidden" value="3" name="comment_action_type_id">
						  	<input type="submit" class="submitStyle" value="Responder" />
						</form>
					</li>
				<%	}
				}
			%>
			</ul>
		<%}
	%>
	</ol>

</div>

</body>
</html>
